package tw.fragmental.barriga.domain;

/**
 * When something is or have to be payed.
 * 
 * @author pcalcado
 * 
 */
public class PayDay {

	public static final PayDay NOT_SET = new PayDay();

	private int day = -1;
	private DayType type = DayType.UNDEFINED;

	public PayDay(DayType type, int day) {
		this.type = type;
		this.day = day;
	}

	private PayDay() {
	}

	public enum DayType {
		BUSINESS, UNDEFINED, MONTH
	}

	public boolean isBefore(PayDay other) {
		if (!other.getType().equals(this.getType()))
			throw new IllegalArgumentException("Can't mix [" + this.getType()
					+ "] and [" + other.getType() + "] pay days");
		
		return this.getDay() <= other.getDay();
	}

	public int getDay() {
		return day;
	}

	public DayType getType() {
		return type;
	}

}
